package com.shoujifeng.snowmusic.player;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.Toast;

import com.shoujifeng.snowmusic.player.R;
import com.shoujifeng.snowmusic.db.DatabaseUtil;

public class RemoveSongMenuActivity extends Activity{
	private Button yesBtn;
	private Button noBtn;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.remove_song_menu);
		init();
	}
	
	private void init(){
		yesBtn = (Button) findViewById(R.id.remove_menu_yes);
		noBtn  = (Button) findViewById(R.id.remove_menu_no);
		yesBtn.setOnClickListener(onClickListener);
		noBtn.setOnClickListener(onClickListener);
	}
	
	private View.OnClickListener  onClickListener = new OnClickListener() {
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			switch (v.getId()) {
			case R.id.remove_menu_yes:
				DatabaseUtil databaseUtil = new DatabaseUtil(RemoveSongMenuActivity.this);
				String name =NativeMusicManageActivity.menu_name;
				NativeMusicManageActivity.menu_name="";
				databaseUtil.deleteMusicMenu(name);
 				Toast.makeText(RemoveSongMenuActivity.this,
						"删除成功", Toast.LENGTH_SHORT)
						.show(); 
 				 Intent intent = new Intent();
 				 intent.putExtra("breakName", name);
				 RemoveSongMenuActivity.this.setResult(2, intent);
				 RemoveSongMenuActivity.this.finish();
				break;
			case R.id.remove_menu_no:
				finish();
				break;	

			default:
				break;
			}
		}
	};
}
